home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 13 / AMIGAplus Sonderheft 13 (1998)(ICP)(DE)[!].iso / rexx / savedesktop.bed < prev    next >
Text File  |  1997-12-03  |  1KB  |  70 lines

  1. /*
  2. ** $VER: SaveDesktop.bed 1.0 (02.01.96)
  3. **
  4. ** Saves the layout of the desktop
  5. ** The parameter QUIT also quit the program
  6. **
  7. ** Written by Marco Negri
  8. */
  9.  
  10. OPTIONS RESULTS
  11. OPTIONS FAILAT 11
  12. PARSE ARG name quit
  13.  
  14. quit = UPPER(quit)
  15.  
  16. IF name = "" THEN DO
  17.     RequestFile SAVEMODE 'TITLE "Select File to Save as Layout"' 'PATTERN "#?.layout"' 'BED:Support/'
  18.     IF RC ~= 0 THEN EXIT
  19.     name = RESULT
  20. END
  21.  
  22. IF RIGHT(name,7) ~= ".layout" THEN name = name || ".layout"
  23.  
  24. ADDRESS BED
  25.  
  26. GetDocuments
  27. docs = RESULT
  28.  
  29. i = 0
  30.  
  31. IF Open(save,name,WRITE) THEN DO
  32.     DO WHILE docs ~= ""
  33.         PARSE VAR docs '"'.'"' port docs
  34.  
  35.         ADDRESS VALUE port
  36.  
  37.         GetFilePath
  38.         WriteLn(save,RESULT)
  39.  
  40.         GetWindowInfo
  41.         PARSE VAR RESULT icon x1 y1 w1 h1 .
  42.  
  43.         IconifyWindow TOGGLE
  44.  
  45.         GetWindowInfo
  46.         PARSE VAR RESULT . x2 y2 w2 h2 .
  47.  
  48.         IconifyWindow TOGGLE
  49.  
  50.         IF icon = ON THEN DO
  51.             str = x2 || '/' || y2 || '/' || w2 || '/' || h2 || '/' || x1 || '/' || y1 || '/ICONIFIED'
  52.         END; ELSE DO
  53.             str = x1 || '/' || y1 || '/' || w1 || '/' || h1 || '/' || x2 || '/' || y2
  54.         END
  55.         WriteLn(save,str)
  56.  
  57.         GetCursorPos
  58.         str = WORD(RESULT,1) WORD(RESULT,2)
  59.         WriteLn(save,str)
  60.  
  61.         WriteLn(save,"")
  62.  
  63.         IF quit='QUIT' THEN CloseDoc
  64.  
  65.         i = i+1
  66.     END
  67.  
  68.     Close(save)
  69. END
  70.